All Functions of Week 8

n

{dplyr}

The number of observations in the current group.

sum

{base}

Get sum of numeric values or a vector

slice

{dplyr}

Select rows by position

rm

{base}

Remove objects

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

write_dta

{haven}

Write Stata files

as.character

{base}

Coerce a vector to character

factor

{base}

Create a factor

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

desc

{dplyr}

Arrange in descending order

summarize

{dplyr}

Collapse the dataset to a summary statistic (American-spelling alias of summarise)

ordered

{dplyr}

Create an ordered factor

quantile

{stats}

Obtain empirical quantiles of a vector

cut

{base}

Convert Numeric to Factor

read_dta

{haven}

Read a .dta file (Stata data)

mean

{base}

Get mean of a vector

filter

{dplyr}

Filter out rows of a data frame according to logical vector

separate

{tidyr}

Split columns

spread

{tidyr}

Spread a key-value pair across multiple columns

recode

{dplyr}

Recode a variable

c

{base}

Combine values/vectors into a vector

as.numeric

{base}

Coerce a vector to numeric

write.csv

{utils}

write a csv file to a data frame

factor

{base}

Create factor variables

arrange

{dplyr}

Sort values of data frame according to a variable/combination of variables

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

mutate

{dplyr}

Create new variables

setwd

{base}

Set Working Directory

select

{dplyr}

Select columns from a tibble/data frame

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

data.frame

{base}

Create a data.frame from vectors

save

{base}

Save R objects

ifelse

{base}

Return a or b depending on the value of test

is.na

{base}

Check if a value is NA/elements of vector are NA

library

{base}

Load an R package

The end!